#include <string.h>
#include "Priority.h"

Priority::Priority() {
	strcpy(level, "554543543254321");
	index = 0;
}

Priority::~Priority() {
}

int Priority::getCurr() {
	return level[index] - 48;	// - 48 converts ascii value to integer
}

/*
int Priority::reset() {
	this->index = 0;

	return getCurr();
}
*/

int Priority::getNext() {
	// advance to next index;
	++ index;

	// reset priority index if necessary
	if(index == strlen(level)) {
		index = 0;
		return -1;
	}

	return getCurr();
}

int Priority::getPrev() {
	// advance to prev index;
	-- index;

	// reset priority index if necessary
	if(index < 0) {
		index = strlen(level) - 1;
		return -1;
	}

	return getCurr();
}